<!DOCTYPE html >
<html>
	<head>
		<meta name="Generator" content="tpshop" />
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width">
		<title>{$goods.goods_name}_{$tpshop_config.shop_info_store_title}</title>
		<meta http-equiv="keywords" content="{$tpshop_config['shop_info_store_keyword']}" />
		<meta name="description" content="{$tpshop_config['shop_info_store_desc']}" />
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
		<link rel="stylesheet" type="text/css" href="__STATIC__/css/public.css" />
		<link rel="stylesheet" type="text/css" href="__STATIC__/css/goods.css" />
		<script type="text/javascript" src="__STATIC__/js/jquery.js"></script>
		<script type="text/javascript" src="__STATIC__/js/touchslider.dev.js"></script>
		<script src="__PUBLIC__/js/global.js"></script>
		<script src="__PUBLIC__/js/mobile_common.js"></script>
		<script src="__STATIC__/js/common.js"></script>
		<style>
		body{
			font-family: -apple-system,Helvetica,sans-serif;
		}
		.info_dottm .name{
			width:100%;
			padding-left: 0;
			margin-left:0;
			vertical-align: bottom;
			line-height: 30px;
		}
		.info_dottm .name em {
		    display: block;
		    float: left;
		    padding-left: 5px;
		    padding-right: 5px;
		    height: 12px;
		    margin-right: 6px;
		    font-size: 10px;
		    color: #FFF;
		    text-align: center;
		    line-height: 12px;
		    margin-top: 6px;
		    background: #dd0303;
		    padding-top: 4px;
		    padding-bottom: 3px;
		}
		.goods_price dt span{
		    font-size: 18px;
		    line-height: 20px;
		    color: #dd2726;
		}
		.goods_price dt font{
			font-size: 14px;
			line-height: 20px;
		}
		.goods_price dt .zhekou{
			text-align:left;
			float:right;
			color:#999;
			font-size:12px;
		}
		.group_infos{
			display: flex;
			align-items: center;
			font-size:12px;
			color:#fff;
			margin-top:2px;
		}
		.group_infos .group-li:nth-child(1) {
			flex:1;
			background: -webkit-linear-gradient(left,#ef3647,#ef3390);
			background: -o-linear-gradient(right,#ef3647,#ef3390);
			background: -moz-linear-gradient(right,#ef3647,#ef3390);
			background: linear-gradient(to right,#ef3647,#ef3390);
			height: 45px;
			line-height: 45px;
			padding-left:5px;
		}
		.group_infos .group-li:nth-child(2) {
			width:100px;
			height: 45px;
			background-color: #feeae9;
			text-align: center;
			line-height: 10px;
		}
		.group_infos .group-li .cnum{
			float: right;
			margin-right:5px;
		}
		.group_infos .group-li .cnum i{
			font-weight: bold;
		}
		.group_infos .group-li .cnum i:nth-child(1){
			font-size:16px;
		}
		.group_infos .group-li .cnum strong{
			margin-right:5px;
			font-weight: bold;
		}
		
		.group_infos .group-li:nth-child(2) span{
			display: inline-block;
			width: 20px;
			height: 24px;
			border-radius: 5px;
			background-color: #ef3561;
			color: #fff;
			font-size: 12px;
			line-height: 24px;
			text-align: center;
			margin-left:5px;
			padding:0px 2px;
		}
		.seckil-time-title {
		    margin: 3px 0 3px;
		    display: inline-block;
		    font-size: 11px;
		    line-height: 11px;
		    color: #e8063c;
		}
		#goods_price{
			font-size:16px;
			font-weight: bold;
		}
		.goods-intro{font-size:12px;line-height: 15px;color:#e94715;padding-left:10px;}
		.info_dottm .name{font-size:14px;padding-left:10px;}
		.product_info .info_dottm{padding-top:2px;padding-bottom:10px;}
		.xiangq li{border:1px solid #ddd;border-top:0px;font-size:12px;color:#999;}
		.xiangq li:first-child{border-top:1px solid #ddd;}
		.xiangq li p{border-right:1px solid #ddd;padding:5px 8px;padding-right:15px;width:75px;}
		.xiangq li span{padding:0px 10px;}
		.sku_int {
		    font-size: 13px;
		    display: inline-block;
		    margin-left: 5px;
		    color: #666;
		    line-height: 20px;
		    vertical-align: middle;
		    margin-top: 8px;
		}

		</style>
	</head>
	<body>
		<script type="text/javascript">
			var process_request = "正在处理您的请求...";
		</script>
		<div class="main">
			<div class="tab_nav">
				<div class="header">
					<div class="h-left">
						<a class="sb-back" href="javascript:history.back(-1)" title="返回"></a>
					</div>
					<div class="h-mid">
						<ul>
							<li><a href="javascript:;" class="tab_head on" id="goods_ka1" onClick="setGoodsTab('goods_ka',1,4)">商品</a></li>
							<li><a href="javascript:;" class="tab_head" id="goods_ka2" onClick="setGoodsTab('goods_ka',2,4)">详情</a></li>
							<li><a href="javascript:;" class="tab_head" id="goods_ka4" onClick="setGoodsTab('goods_ka',4,4)">属性</a></li>
							<li><a href="javascript:;" class="tab_head" id="goods_ka3" onClick="setGoodsTab('goods_ka',3,4)">评价</a></li>
						</ul>
					</div>
					<div class="h-right">
						<aside class="top_bar">
							<div onClick="show_menu();$('#close_btn').addClass('hid');" id="show_more">
								<a href="javascript:;"></a>
							</div>
							<a href="{:U('Mobile/Cart/cart')}" class="show_cart"><em class="global-nav__nav-shop-cart-num" id="tp_cart_info"></em></a>
						</aside>
					</div>
				</div>
			</div>
			<include file="public/menu" />
			<div class="main" id="user_goods_ka_1" style="display:block;">
				<div class="banner">
					<div id="slider" class="slider" style="overflow: hidden; visibility: visible; list-style: none; position: relative;">
						<ul id="sliderlist" class="sliderlist" style="position: relative; overflow: hidden; transition: left 600ms ease; -webkit-transition: left 600ms ease;">
							<foreach name="goods_images_list" item="pic">
								<li style="float: left; display: block; width: 100%;"><span><a  href="javascript:void(0)">
      							<img title="" width="100%" src="{$pic.image_url}"></a></span></li>
							</foreach>
						</ul>
						<div id="pagenavi">
							<foreach name="goods_images_list" item="pic" key="k">
								<a href="javasscript:void(0);" <if condition="$k eq 0">class="active"</if>></a>
							</foreach>
						</div>
					</div>
				</div>
				<div class="s_bottom"></div>
				<script type="text/javascript">
					$(function() {
						$("div.module_special .wrap .major ul.list li:last-child").addClass("remove_bottom_line");
					});
					var active = 0,
						as = document.getElementById('pagenavi').getElementsByTagName('a');

					for (var i = 0; i < as.length; i++) {
						(function() {
							var j = i;
							as[i].onclick = function() {
								t2.slide(j);
								return false;
							}
						})();
					}
					var t2 = new TouchSlider({
						id: 'sliderlist',
						speed: 600,
						timeout: 6000,
						before: function(index) {
							as[active].className = '';
							active = index;
							as[active].className = 'active';
						}
					});
				</script>
				<form name="buy_goods_form" method="post" id="buy_goods_form">
					<div class="product_info">
						<div class="group_infos">
							<div class="group-li"><span id="goods_price" >￥<i style="font-size:28px!important;font-weight: bold;">{$goods.price}</i></span><font style="text-decoration:line-through;margin-left:2px">￥{$goods.market_price}</font><span class="cnum"><strong>已抢:</strong><i style="font-size:16px">{$goods[buy_num]}</i>/<i>{$goods[goods_num]}</i>件</span></div>
							<div class="group-li">
							<if condition="$goods[buy_num] eq $goods[goods_num]">
							<dd style="font-size:18px;line-height:45px;color:#666">已告罄</dd>
							<else/>
							<p class="seckil-time-title">距结束还剩:</p><p id="leftTime"></p>
							</if>
							</div>
						</div>
						<div class="info_dottm" style="background:#fff;height:30px">
							<h3 class="name" style="height:30px"><em>秒杀</em>{$goods.goods_name}</h3>
							<!-- <div class="right"> -->

								<!-- <a href="http://www.jiathis.com/share" class="jiathis jiathis_txt" target="_blank">
									<div id="pro_share" class="share"></div>
								</a> --> 
								<!-- <script>
									var jiathis_config = {
										url: "http://{$_SERVER[HTTP_HOST]}/index.php?m=Home&c=Goods&a=goodsInfo&id={$Request.param.id}",
										pic: "http://{$_SERVER[HTTP_HOST]}{$goods[goods_id]|goods_thum_images=400,400}",
									}
									var is_distribut = getCookie('is_distribut');
									var user_id = getCookie('user_id');
									// 如果已经登录了, 并且是分销商
									if (parseInt(is_distribut) == 1 && parseInt(user_id) > 0) {
										jiathis_config.url = jiathis_config.url + "&first_leader=" + user_id;
									}
									//alert(jiathis_config.url);
								</script>
								<script type="text/javascript" src="http://v3.jiathis.com/code_mini/jia.js" charset="utf-8"></script> -->
								<!-- JiaThis Button END -->

							<!-- </div> -->
						</div>
						<div class="goods-intro">{$group_buy_info.intro}</div>
						<!-- <dl class="goods_price">
							<dt><span>团购价:</span><span id="goods_price" ><i style="font-size:25px!important;font-weight: bold;">￥{$group_buy_info.price}</i>元</span><font>价格:￥{$goods.market_price}元</font> <span class="zhekou">折扣：{$group_buy_info.rebate}折</span></dt>
						</dl> -->
						<!-- <div class="group_infos">
							<div><span><em>{$group_buy_info[goods_num]}</em>人</span><span>目标人数</span></div>
							<div><span id="leftTime">24:13:52</span><span>截止时间</span></div>
							<div><span><em>{$group_buy_info[virtual_num] + $group_buy_info[buy_num]}</em>人</span><span>已参团</span></div>
						</div> -->
						
						<script>
                            // 倒计时
                            function GetRTime2(){
								var text = GetRTime('{$goods.end_time|date="Y/m/d H:i:s",###}');								
                                $("#leftTime").html(text);
                            }
                            setInterval(GetRTime2,1000);
                        </script>
						<!-- <ul class="price_dottm">
							
							<li>{$commentStatistics.c0}人评价</li>
							<li style=" text-align:right">{$group_buy_info[virtual_num] + $group_buy_info[buy_num]}人已参团</li>
						</ul> -->
					</div>

					<section id="search_ka" class="huodong">
						<div class="subNav">
							<div class="att_title"> <span>折</span>
								<p>优惠信息</p>
							</div>
						</div>
						<div class="navContent">
							<if condition="$prom_goods neq null">
								<ul class="youhui_list1">
									<li>
										<a href="javascript:void(0);" title="{$prom_goods[name]}"><img src="__STATIC__/images/hui.png"></a>
										<a href="javascript:void(0);">{$prom_goods[name]}&nbsp;&nbsp;(活动时间：{$prom_goods[start_time]|date="m月d日",###} - {$prom_goods[end_time]|date="m月d日",###})</a>
									</li>
								</ul>
							</if>
							<tpshop sql="select * from `__PREFIX__prom_order` where start_time elt '$time' and end_time egt '$time' order by  id desc limit 5" item="v" key="k">
								<ul class="youhui_list1" style="margin-top:0px;">
								    <if condition="strpos($v['group'],(string)$level) gt -1">
										<li><img src="__STATIC__/images/hui.png">{$v['name']}&nbsp;&nbsp;(活动时间：{$v[start_time]|date="m月d日",###} - {$v[end_time]|date="m月d日",###})</li>
									</if>
								</ul>
							</tpshop>
							<div class="blank10"></div>
						</div>
					</section>
					<script>
					var size=$('.navContent').find('li').size();
					if(size<1){$('#search_ka').css('display','none')}
					</script>

					<!-------商品属性-------->
					<if condition="$filter_spec neq ''"> 
						<section id="search_ka">
							<!---属性---->
							<div class="ui-sx bian1">
								<div class="subNavBox">
									<div class="subNav on"><strong>选择商品属性</strong></div>

									<ul class="navContent" style="display:block">
										<foreach item="spec" key="key" name="filter_spec">
											<li>
												<div class="title">{$key}</div>
												<div class="item">
													<foreach name="spec" item="v2" key="k2">
														<a href="javascript:;" onclick="switch_spec(this);" title="{$v2[item]}" <if condition="$k2 eq 0">class="hover"</if>>
											          	<input type="radio" style="display:none;" name="goods_spec[{$key}]" value="{$v2[item_id]}" <if condition="$k2 eq 0 ">checked="checked"</if>/>
										          		{$v2[item]}            
										          	  </a>
													</foreach>
												</div>
											</li>
										</foreach>
									</ul>
								</div>
							</div>
						</section>
					</if>
					<section id="search_ka">
						<div class="ui-sx bian1">
							<div class="subNavBox">
								<div class="subNav on"><strong>购买数量</strong></div>
								<ul class="navContent" style="display: block;">
									<li style=" border-bottom:1px solid #eeeeee">
										<div class="item1">
											<span class="ui-number">
						                  <button type="button" class="decrease" onClick="goods_cut();">-</button>
						                    <input type="text" class="num" id="number" name="goods_num" value="1" min="1" max="1000"/>
						                    <input type="hidden" name="goods_id" value="{$goods.goods_id}"/>
						                  <button type="button" class="increase" onClick="goods_add();">+</button>
						                  </span> <span class="sku_int"></span><input type="hidden" value="" id="total_num" name="total_num"><input type="hidden" value="" id="sku_int" name="sku_int">

						                </div>
									</li>
								</ul>
							</div>
						</div>
					</section>
					<!-- <section id="search_ka">
						<div class="ui-sx bian1">
							<div class="subNavBox">
								<div class="subNav"><strong>会员专享价</strong></a>
								</div>
								<ul class="navContent">
									<li  class="user_price">
						              <tpshop sql="select * from __PREFIX__user_level" item="v" key="k">
						                <div style="width:50%;float:left"><span class="key">{$v.level_name}：</span> <b class="p-price-v">{$v.discount|zhekshow=###}折</b> </div>
						              </tpshop>
						             </li>
								</ul>
							</div>
						</div>
					</section> -->
					<script type="text/javascript">
						$(function() {
							$(".subNav").click(function() {
								$(this).next(".navContent").slideToggle(300).siblings(".navContent").slideUp(500);
								$(this).toggleClass("on").siblings(".subNav").removeClass("on");
								if ($(".is_scroll").length <= 0) {
									$('html,body').animate({
										'scrollTop': $('body')[0].scrollHeight
									}, 600);
								}
							});
							commentType = 1; // 评论类型
							ajaxComment(1, 1); // ajax 加载评价列表
						})
					</script>
					<script type="text/jscript">
						function click_search() {
							var search_ka = document.getElementById("search_ka");
							if (search_ka.className == "s-buy open ui-section-box") {
								search_ka.className = "s-buy ui-section-box";
							} else {
								search_ka.className = "s-buy open ui-section-box";
							}
						}

						function changeAtt(t) {
							t.lastChild.checked = 'checked';
							for (var i = 0; i < t.parentNode.childNodes.length; i++) {
								if (t.parentNode.childNodes[i].className == 'hover') {
									t.parentNode.childNodes[i].className = '';
									t.childNodes[0].checked = "checked";
								}
							}
							t.className = "hover";
							changePrice();
						}

						function changeAtt1(t) {
							t.lastChild.checked = 'checked';
							for (var i = 0; i < t.parentNode.childNodes.length; i++) {
								if (t.className == 'hover') {
									t.className = '';
									t.childNodes[0].checked = false;
								} else {
									t.className = "hover";
									t.childNodes[0].checked = true;
								}
							}
							changePrice();
						}

						function goods_cut() {
							var num_val = document.getElementById('number');
							var new_num = num_val.value;
							var Num = parseInt(new_num);
							if (Num > 1) Num = Num - 1;
							num_val.value = Num;
						}

						function goods_add() {
							var num_val = document.getElementById('number');
							var new_num = num_val.value;
							var Num = parseInt(new_num);
							Num = Num + 1;
							num_val.value = Num;
						}
					</script>
					<div style=" height:8px; background:#eeeeee; margin-top:-1px;"></div>
					<!--
      <div class="is_scroll">
        <section id="search_ka">
          <div class="ui-sx bian1">
            <div class="subNavBox" >
              <div class="subNav" style=" border:0;"><a href="pocking.php?id=22" style=" border:0px;"><strong>自提点</strong></a></div>
            </div>
          </div>
        </section>
      </div>
      -->
					<!--
      <div class="is_scroll">
        <input type="hidden" id="chat_supp_id" value="1" />
        <div style=" height:8px; background:#eeeeee; margin-top:-1px;"></div>
        <section class="rzs_info">
          <div class="top_info">
            <dl>
              <dt><a href="supplier.php?suppId=1">
                <div style="background-image:url(./..//data/supplier/logo/logo_supplier1.jpg)"></div>
                </a></dt>
              <dd><strong>卖家: <a href="supplier.php?suppId=1" style="color:#333; font-size:18px;">天天果园旗舰店</a></strong><em>初级店铺</em></dd>
            </dl>
            <ul>
              <li><span>宝贝描述</span><strong>:5.0</strong><em>高</em></li>
              <li><span>卖家服务</span><strong>:5.0</strong><em>高</em></li>
              <li><span>物流服务</span><strong>:5.0</strong><em>高</em></li>
            </ul>
          </div>
          <div class="s_dianpu"> <span><a href="tel:03350785268" style=" margin-left:7%;"><em class="bg1"></em>联系客服</a></span> <span><a href="supplier.php?suppId=1" style=" margin-left:3%;"><em class="bg2"></em>进入店铺</a></span> </div>
        </section>
      </div> 
      -->
				</form>
			</div>
	
			<div class="main" id="user_goods_ka_2" style="display:none;">
				<div class="product_main" style=" margin-top:40px;">
					<!-- 产品图片 -->
					<div class="product_images product_desc" id="product_desc"> {$goods.goods_content|htmlspecialchars_decode} </div>
				</div>
			</div>
			<div class="main" id="user_goods_ka_4" style="display:none;">
				<div class="product_main" style=" margin-top:40px;">
					<section class="index_floor">
					       <ul class="xiangq">
					          <foreach name="goods_attr_list" item="v" key="k" >
					          <li><p>{$goods_attribute[$v[attr_id]]}</p><span>{$v[attr_value]}</span></li>
					          </foreach>
					       </ul>
					   </section>
				</div>
			</div>
			<div class="tab_attrs tab_item hide" id="user_goods_ka_3" style="display:none;">

				<div id="ECS_COMMENT">
					<link href="__STATIC__/css/photoswipe.css" rel="stylesheet" type="text/css">
					<script src="__STATIC__/js/klass.min.js"></script>
					<script src="__STATIC__/js/photoswipe.js"></script>
					<div class="my_comment_list" id="ECS_MYCOMMENTS"> </div>

				</div>
			</div>
		</div>
		<script>
			function goTop() {
				$('html,body').animate({
					'scrollTop': 0
				}, 600);
			}
		</script>
		<a href="javascript:goTop();" class="gotop"><img src="__STATIC__/images/topup.png"></a>
		<div style=" height:60px;"></div>
		<div class="footer_nav">
			<ul>
				<li class="bian"><a href="{:U('Index/index')}"><em class="goods_nav1"></em><span>首页</span></a> </li>
				<li class="bian"><a href="tel:{$tpshop_config['shop_info_phone']}"><em class="goods_nav2"></em><span>客服</span></a> </li>
				<li><a href="javascript:collect_goods({$goods.goods_id})" id="favorite_add"><em class="goods_nav3"></em><span>收藏</span></a></li>
			</ul>
			<dl>
				<dd class="flow"><a class="button active_button" href="javascript:void(0);" onClick="AjaxAddCart({$goods.goods_id},1,0);">加入购物车</a> </dd>
				<dd class="goumai"><a style="display:block;" href="javascript:void(0);" onClick="AjaxAddCart({$goods.goods_id},1,1);">立即购买</a> </dd>
			</dl>
		</div>
		<script type="text/javascript" src="__PUBLIC__/static/js/layer/layer.js"></script>
		<script type="text/javascript">
			function switch_spec(spec) {
				$(spec).siblings().removeClass('hover');
				$(spec).addClass('hover');
				$(spec).siblings().children('input').prop('checked', false);
				$(spec).children('input').prop('checked', true);
				//更新商品价格
				get_goods_price();
				//显示库存
				show_sku_store();
			}

			//显示外部库存
			
			var outer_storege='{$outer_storege}';//外部库存是否开启
			var total_num=0;
			var sku_int=0;
			function show_sku_store(){
			  if(outer_storege==1){
			  	var size_color='';
			  	  $('.item').each(function(){
			  	    size_color+=$(this).children('a.hover').children('input').val()+'_';
			  	  })
			  	  size_color=size_color.substr(0,size_color.length-1);
			  	$.post('{:U("Goods/sync_store")}',{goods_id:'{$goods.goods_id}',goods_sn:'{$goods.goods_sn}',size_color:size_color},function(res){
			  	   var obj=jQuery.parseJSON(res);
			  	   sku_int=obj.current_num;
                 $('.sku_int').html('(库存:<i>'+obj.current_num+'</i>件)')
                 $('#sku_int').val(obj.current_num);
                 $('#total_num').val(obj.total_num);
			  	})
			  }
			  
			}

			function get_goods_price() {
				var goods_price = {$goods.shop_price}; // 商品起始价
				var store_count = {$goods.store_count}; // 商品起始库存	
				if(outer_storege==1){
				  store_count=total_num;
				}
				var spec_goods_price = {$spec_goods_price}; // 规格 对应 价格 库存表   //alert(spec_goods_price['28_100']['price']);	
				// 如果有属性选择项
				if (spec_goods_price != null) {
					goods_spec_arr = new Array();
					$("input[name^='goods_spec']:checked").each(function() {
						goods_spec_arr.push($(this).val());
					});
					var spec_key = goods_spec_arr.sort(sortNumber).join('_'); //排序后组合成 key	
					goods_price = spec_goods_price[spec_key]['price']; // 找到对应规格的价格		
					store_count = spec_goods_price[spec_key]['store_count']; // 找到对应规格的库存
				}
				
					var goods_num = parseInt($("#goods_num").val());
					// 库存不足的情况
					if (goods_num > store_count) {
						goods_num = store_count;
						alert('库存仅剩 ' + store_count + ' 件');
						$("#goods_num").val(goods_num);
					}
				
				
				//$("#goods_price").html('￥' + goods_price + '元'); // 变动价格显示

			}

			function sortNumber(a, b) {
				return a - b;
			}

			function ajaxComment(commentType, page) {
				$.ajax({
					type: "GET",
					url: "/index.php?m=Mobile&c=goods&a=ajaxComment&goods_id={$goods['goods_id']}&commentType=" + commentType + "&p=" + page, //+tab,
					success: function(data) {
						$(".my_comment_list").empty().append(data);
						var myPhotoSwipe = $("#gallery a").photoSwipe({
							enableMouseWheel: false,
							enableKeyboard: false,
							allowUserZoom: false,
							loop: false
						});
					}
				});
			}

			$(document).ready(function() {
				var cart_cn = getCookie('cn');
				if (cart_cn == '') {
					$.ajax({
						type: "GET",
						url: "/index.php?m=Home&c=Cart&a=header_cart_list", //+tab,
						success: function(data) {
							cart_cn = getCookie('cn');
						}
					});
				}
				$('#tp_cart_info').html(cart_cn);
			});

			 //预览图片
         
              $('.sliderlist').find('img').click(function(){
             
                  var $this=$(this);
                  var h=$this.css('height');
                  var url = "{:U('Goods/viewpic')}";
                      layer.open({
                          type: 2,
                          title: '',
                          shadeClose: true,
                          shade: 0.8,
                          area: ['100%', h],
                          content: url
                      });

                  $('.layui-layer-close2').css({'margin-right':'15px','margin-top':'15px'})
              })
		</script>
		<script src="__PUBLIC__/js/jqueryUrlGet.js"></script>
		<!--获取get参数插件-->
		<script>
			set_first_leader(); //设置推荐人
			show_sku_store();//展示外部库存
		</script>
		<!-- 微信浏览器 调用微信 分享js-->
		<if condition="$signPackage neq null">
			<include file="public/goods_share" />
		</if>
		<!-- 微信浏览器 调用微信 分享js  end-->
	</body>
</html>